import React from "react";
import {Button} from "antd";

import {observable , action , autorun} from "mobx";
import {observer} from "mobx-react";



class Store {
    @observable
    num = 0
   @action
    addFn = () => {
        this.num++
        // console.log(this.num)
    }
}

const store = new Store
autorun(() => {
    console.log(store.num)
})
setTimeout(()=>{
    store.addFn()
},1000)
@observer
class Dom8 extends React.Component{
    render() {
        return <>
            <div>{store.num}</div>
            <Button onClick={() => store.addFn()}>num++</Button>
        </>

    }
}



export default Dom8
